#!/bin/sh

if [ -x "$(which brew)" ]; then
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libffi)/lib/pkgconfig"
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libarchive)/lib/pkgconfig"
  export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix cfitsio)/lib/lib/pkgconfig"
  export CGO_LDFLAGS="$CGO_LDFLAGS -Wl,-no_warn_duplicate_libraries"
fi

export CGO_LDFLAGS_ALLOW="-s|-w"
export CGO_CFLAGS_ALLOW="-I|-Xpreprocessor"

if [ -x "$(which gotestsum)" ]; then
  gotestsum ./...
else
  go test -v ./...
fi
